home *** CD-ROM | disk | FTP | other *** search
/ Small Time Crooks Press Kit / Small Time Crooks Press Kit.iso / pc / Small Time Crooks.dxr / Scripts_21_Text Select-Toggle Button.ls < prev    next >
Encoding:
Text File  |  2000-04-30  |  4.6 KB  |  145 lines

  1. property pTextName, pWhatChanges, pWhatShows, pDestination, pTemp, pGroupName, pInitialState, pNumStates, pComplexString, ancestor
  2. global gCurrentText, gDownloadTexts
  3.  
  4. on beginSprite me
  5.   set pTemp to "temp"
  6.   set previousItemDelimiter to the itemDelimiter
  7.   set the itemDelimiter to "."
  8.   set pTextName to item 1 of the name of the member of sprite the spriteNum of me
  9.   set the itemDelimiter to previousItemDelimiter
  10.   if pWhatShows = #gCurrentTextStatus then
  11.     if pInitialState = #on then
  12.       set gCurrentText to pTextName
  13.       sendAllSprites(#UpdateDetail, #text)
  14.     end if
  15.   else
  16.     if pWhatShows = #selectedToDownLoadStatus then
  17.       if pTextName = "gCurrent" then
  18.         if getPos(gDownloadTexts, gCurrentText) then
  19.           set pInitialState to #on
  20.         else
  21.           set pInitialState to #off
  22.         end if
  23.       else
  24.         if getPos(gDownloadTexts, pTextName) then
  25.           set pInitialState to #on
  26.         else
  27.           set pInitialState to #off
  28.         end if
  29.       end if
  30.     end if
  31.   end if
  32.   if pNumStates = #complex then
  33.     set pNumStates to value(pComplexString)
  34.   end if
  35.   set numTrans to pNumStates
  36.   if pWhatShows = #nothing then
  37.     set togSty to 0
  38.   else
  39.     set togSty to 1
  40.   end if
  41.   set selfTog to pWhatChanges = pWhatShows
  42.   set togGrup to pGroupName
  43.   set togState to pInitialState
  44.   if pWhatShows = #gCurrentTextStatus then
  45.     set togOffbl to 0
  46.   else
  47.     if pWhatShows = #selectedToDownLoadStatus then
  48.       set togOffbl to 1
  49.     end if
  50.   end if
  51.   if pWhatChanges = #gCurrentTextStatus then
  52.     set togOnOthOff to 1
  53.   else
  54.     set togOnOthOff to 0
  55.   end if
  56.   set ancestor to new(script "Bitmap But 1", the spriteNum of me, numTrans, togSty, togGrup, togState, togOffbl, selfTog, togOnOthOff)
  57.   UpdateWhatItShows(me)
  58. end
  59.  
  60. on MouseUpAction me
  61.   if pWhatChanges = #gCurrentTextStatus then
  62.     set gCurrentText to pTextName
  63.     sendAllSprites(#UpdateDetail, #text)
  64.     sendAllSprites(#UpdateWhatItShows)
  65.   else
  66.     if pWhatChanges = #selectedToDownLoadStatus then
  67.       if pTextName = "gCurrent" then
  68.         if not getPos(gDownloadTexts, gCurrentText) then
  69.           append(gDownloadTexts, gCurrentText)
  70.         else
  71.           deleteAt(gDownloadTexts, getPos(gDownloadTexts, gCurrentText))
  72.         end if
  73.       else
  74.         if not getPos(gDownloadTexts, pTextName) then
  75.           append(gDownloadTexts, pTextName)
  76.         else
  77.           deleteAt(gDownloadTexts, getPos(gDownloadTexts, pTextName))
  78.         end if
  79.       end if
  80.     end if
  81.   end if
  82.   if pDestination <> EMPTY then
  83.     go(pDestination)
  84.   end if
  85. end
  86.  
  87. on MouseDownAction me
  88.   nothing()
  89. end
  90.  
  91. on MouseEnterAction me
  92.   nothing()
  93. end
  94.  
  95. on MouseLeaveAction me
  96.   nothing()
  97. end
  98.  
  99. on UpdateWhatItShows me
  100.   if pWhatShows = #selectedToDownLoadStatus then
  101.     if pTextName = "gCurrent" then
  102.       if getPos(gDownloadTexts, gCurrentText) then
  103.         set state to #on
  104.       else
  105.         set state to #off
  106.       end if
  107.     else
  108.       if getPos(gDownloadTexts, pTextName) then
  109.         set state to #on
  110.       else
  111.         set state to #off
  112.       end if
  113.     end if
  114.     if not (state = the pToggleState of me) then
  115.       set the pToggleState of me to state
  116.       setstate(me, the pCurrentState of me)
  117.     end if
  118.   end if
  119. end
  120.  
  121. on getPropertyDescriptionList me
  122.   set description to [:]
  123.   addProp(description, #pInitialState, [#default: #off, #format: #symbol, #comment: "Initial State", #range: [#off, #on]])
  124.   addProp(description, #pWhatChanges, [#default: #gCurrentTextStatus, #format: #symbol, #comment: "What It Changes", #range: [#nothing, #gCurrentTextStatus, #selectedToDownLoadStatus]])
  125.   addProp(description, #pWhatShows, [#default: #gCurrentTextStatus, #format: #symbol, #comment: "What It Shows", #range: [#nothing, #gCurrentTextStatus, #selectedToDownLoadStatus]])
  126.   addProp(description, #pGroupName, [#default: "TextButtons", #format: #string, #comment: "Toggle Group Name"])
  127.   addProp(description, #pDestination, [#default: EMPTY, #format: #string, #comment: "Frame Destination"])
  128.   addProp(description, #pNumStates, [#default: 3, #format: #symbol, #comment: "Number of States", #range: [2, 3, 4, 5, 6, #complex]])
  129.   addProp(description, #pComplexString, [#default: "[[1,0],[1,0],[1,0],[#m,0],[#m,0],[#m,0]]", #format: #string, #comment: "Complex Array"])
  130.   return description
  131. end
  132.  
  133. on getBehaviorDescription me
  134.   set endChar to offset("--END OF HEADER", the text of me)
  135.   set endLine to the number of lines in char 1 to endChar of the text of me - 1
  136.   set description to line 1 to endLine of the text of me
  137.   repeat with whichLine = endLine down to 1
  138.     if line whichLine of description = EMPTY then
  139.       delete line whichLine of description
  140.     end if
  141.   end repeat
  142.   delete line 1 of description
  143.   return description
  144. end
  145.